#pragma once
#include "mytypes.h"
#include "interfaces.h"
#include "Polygon.h"

namespace poly
{
	class PolygonView : public IGraphic
	{
	public:
		PolygonView( D3DDevice device = 0 );
		~PolygonView();
		void initialize( D3DDevice device );
		void destroy();

		Polygon polygon() const;
		float4 color() const;

		void setup( Polygon const & P, float4 const & c );

		void render( float44 const & );

	private:
		void setPolygon( Polygon const & P );
		void setColor( float4 const & c );

		Polygon			m_polygon;
		D3DDevice		m_device;
		VertexBuffer	m_vertexBuffer;
		float4			m_color;

		static const DWORD FVF;
		static const uint32 vertexSize;
	};
}
